#include "misc.h"

node &node::operator=(node &old)
{
    this->profit = old.profit;
    this->weight = old.weight;
    this->step = old.step;
    this->size = old.size;

    /* copy the solution */
    vector<int>().swap(this->solution);
    for (auto &e : old.solution)
        this->solution.push_back(e);
    return *this;
}

node::node(const int *solution, const int &profit, const int &weight, const int &step, const int &size)
{
    this->profit = profit;
    this->weight = weight;
    this->step = step;
    this->size = size;

    /* copy the solution */
    for (int i = 0; i < this->size; i++)
        this->solution.push_back(solution[i]);
}